package com.cn.controller;

import com.cn.response.Result;
import com.cn.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 功能描述: <br>
 *
 * @program: wx-nimi-bank
 * @description: 用户登录控制层
 * @author: Mr.TYJ
 * @create: 2022-06-20 14:12
 **/
@RestController
@CrossOrigin
@Slf4j
@Api(tags = "侧边菜单控制层")
@RequestMapping("/user")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @ApiOperation(value = "用户登录")
    @PostMapping("/login")
    public Result login(@RequestParam(value = "username",required = true) String username,
                        @RequestParam(value = "password",required = true)  String password){
        String token=sysUserService.loginUserByCard(username, password);
        return Result.ok().data("token",token);
    }
}
